import java.util.Comparator;




public class WarehouseComparatorTotalCost implements Comparator<Warehouse>
{
	boolean ascending;
	
	public WarehouseComparatorTotalCost(boolean ascending)
	{
		this.ascending = ascending;
	}
	
	public int compare(Warehouse w1, Warehouse w2)
	{
		if(ascending == true)
		{
	       return w1.totalCost >= w2.totalCost ? 1 : 0;
	    }
		else
		{
	    	return w1.totalCost >= w2.totalCost ? 0 : 1;
	    }
	}
}
